package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.OrderSetting;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.SetMealService;
import com.itheima.health.util.SMSUtils;
import com.itheima.health.util.ValidateCodeUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @author ：石破天
 * @date ：Created in 2022年06月07日
 * @description ：
 * @version: 1.0
 */
@RestController
@RequestMapping("/mobile/setmeal")
@Slf4j
public class MobileSetMealController {

    @Autowired
    private SetMealService setMealService;

    //预约体检，查询所有套餐
    @GetMapping("/getSetmeal")
    public Result getSetmeal() {
        log.info("查询所有套餐");
        List<Setmeal> setmeals = setMealService.findAll();
        return new Result(true, MessageConst.GET_SETMEAL_LIST_SUCCESS, setmeals);
    }

    //体检预约功能-套餐详情
    @GetMapping("/findById")
    public Result findById(Integer id) {
        log.info("[移动端套餐的详情],id:{}", id);
        Setmeal setMealServiceById = setMealService.selectById(id);
        return new Result(true,MessageConst.QUERY_SETMEAL_SUCCESS,setMealServiceById);
    }

}
